{include file="public/header" /}

<style>
    .popup-img{
        transition: opacity .3s ease;
        position: fixed;
        align-items: center;
        justify-content: center;
        /*display: none;*/
        display: flex;
        width: 100%;
        width: 100%;
        z-index: 999;
        opacity: 0;
    }
    .popup-img.show{
        opacity: 1;
    }

    .popup-img img{
        width: 0;
        height: 0;
        transition: width .3s ease, height .3s ease;
    }

    .popup-img.show img{
        width: 400px;
        height: 500px;
    }
/*    */
    .popup-imgs{
        transition: opacity .3s ease;
        position: fixed;
        align-items: center;
        justify-content: center;
        /*display: none;*/
        display: flex;
        width: 100%;
        width: 100%;
        z-index: 999;
        opacity: 0;
    }
    .popup-imgs.show{
        opacity: 1;
    }

    .popup-imgs img{
        width: 0;
        height: 0;
        transition: width .3s ease, height .3s ease;
    }

    .popup-imgs.show img{
        width: 400px;
        height: 500px;
    }

</style>

<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>{$Think.lang.adv_index_manage}</h3>
            </div>
            {include file="public/admin_items" /}
        </div>
    </div>
    <form method="get" name="formSearch" id="formSearch">
        <div class="ds-search-form">
            <dl>
                <dt>广告名称</dt>
                <dd><input class="txt" type="text" name="search_name" id="search_name" value="{$Request.param.search_name}" /></dd>
            </dl>
            <dl>
                <dt>所属位置</dt>
                <dd>
                    <select name="adv_address">
                        <option value='0'>请选择</option>
                        <option value='1' {if condition="$adv_address eq 1"}selected{/if}>客户端主页</option>
                        <option value='2' {if condition="$adv_address eq 2"}selected{/if}>客户端商城</option>
                        <option value='3' {if condition="$adv_address eq 3"}selected{/if}>服务端培训</option>
                    </select>
                </dd>
            </dl>
            <dl>
                <dt>类型</dt>
                <dd>
                    <select name="search_adv_type">
                        <option value='0'>请选择</option>
                        <option value='1' {if condition="$search_adv_type eq 1"}selected{/if}>轮播图</option>
                        <option value='2' {if condition="$search_adv_type eq 2"}selected{/if}>广告图</option>
                    </select>
                </dd>
            </dl>
            <dl>
                <dt>所属分类</dt>
                <dd>
                    <select name="ap_id">
                        <option value='0' >请选择</option>
                        <option value='1' {if condition="$ap_id eq 1"}selected{/if}>文章类</option>
                        <option value='2' {if condition="$ap_id eq 2"}selected{/if}>满减</option>
                        <option value='3' {if condition="$ap_id eq 3"}selected{/if}>折扣</option>
                        <option value='4' {if condition="$ap_id eq 4"}selected{/if}>项目定制</option>
                    </select>
                </dd>
            </dl>

            <div class="btn_group">
                <input type="submit" class="btn" value="{$Think.lang.ds_search}">
                {if $filtered}
                <a href="{:url('Adv/adv')}" style="margin-left: 87px;margin-top: -52px;" class="btn btn-default" title="{$Think.lang.ds_cancel}">{$Think.lang.ds_cancel}</a>
                {/if}
            </div>
            <div class="btn_group">
                <div style="width: 90px;"  id="homepage"  class="btn" value="主页示例图">主页示例图</div>
                <div style="width: 90px;"  id="mall" class="btn" value="商城主页示例图">商城主页示例图</div>
            </div>
        </div>
    </form>
    <div id="popup-img" class="popup-img" style="">
        <img style=""  src="{$Think.ADMIN_SITE_ROOT}/images/shang.png" alt="">
    </div>
    <div id="popup-imgs" class="popup-imgs" style="">
        <img style=""  src="{$Think.ADMIN_SITE_ROOT}/images/zhu.jpg" alt="">
    </div>

    <div class="explanation" id="explanation">
        <div class="title" id="checkZoom">
            <h4 title="{$Think.lang.ds_explanation_tip}">{$Think.lang.ds_explanation}</h4>
            <span id="explanationZoom" title="{$Think.lang.ds_explanation_close}" class="arrow"></span>
        </div>
        <ul>
            <li>
                1.客户端主页默认最多七个图，按排序设置顺序放置到前端，广告设置数量为3，6，7其他情况影响显示效果；<br>2.客户商城广告最多2个，一个广告为横屏展示，图片大小参照设计图；
            </li>
        </ul>
</div>
    <div class="fixed-empty"></div>
    <form method="post" id="store_form">
        <table class="ds-default-table">
            <thead>
                <tr class="thead">
                    <th class="w30">序号</th>
                    <th class="w300">{$Think.lang.adv_name}</th>
                    <th class="w300">广告位置</th>
                    <th class="w300">类型</th>
                    <th class="w300">广告分类</th>
                    <th class="w200">{$Think.lang.adv_sort}</th>
                    <th class="w200">{$Think.lang.adv_enabled}</th>
                    <th class="w200">{$Think.lang.ds_start_time}</th>
                    <th class="w200">{$Think.lang.ds_end_time}</th>
                    <th class="align-center w300">{$Think.lang.ds_handle}</th>
                </tr>
            </thead>
            <tbody>

                {notempty name="adv_info"}
                <?php  $index=1; ?>
                {foreach name="adv_info" item="v"}
                <tr class="hover" id="ds_row_{$v.adv_id}">
                    <td class="name">{$index}</td>
                    <td class="name">{$v.adv_title}</td>
                    <td class="name">
                        {if condition="($v.adv_address==1)"}客户端主页
                        {elseif condition="($v.adv_address==2)"}客户端商城
                        {elseif condition="($v.adv_address==3)"}服务端培训
                        {/if}
                    </td>
                    <td>{$adv_type[$v.adv_type]}</td>
                    <td>
                        {if condition="($v.ap_id==1)"}文章类
                        {elseif condition="($v.ap_id==2)"}满减
                        {elseif condition="($v.ap_id==3)"}折扣
                        {elseif condition="($v.ap_id==4)"}项目定制
                        {elseif condition="($v.ap_id==5)"}视频类
                        {/if}
                    </td>
                    <td class="sort"><span title="{$Think.lang.ds_editable}" ajax_branch="adv_branch" datatype="number" fieldid="{$v.adv_id}" fieldname="adv_sort" ds_type="inline_edit" class="editable">{$v.adv_sort}</span></td>
<!--                    <td>{$v.adv_clicknum|default='0'}</td>-->
                    <td>
                        {if $v.adv_enabled eq '0'}
                        关闭
                        {else /}
                        开启
                        {/if}
                    </td>
                    <td>{$v.adv_startdate|date='Y-m-d H:i:s',###}</td>
                    <td>{$v.adv_enddate|date='Y-m-d H:i:s',###}</td>
                    <td>
                        <a href="javascript:dsLayerOpen('{:url('Adv/adv_detail',['adv_id'=>$v.adv_id])}','查看-{$v.adv_title}','1000px','780px')" class="dsui-btn-edit"><i class="iconfont"></i>查看详情</a>
                     <a href="javascript:dsLayerOpen('{:url('Adv/adv_edit',['adv_id'=>$v.adv_id])}','{$Think.lang.ds_edit}-{$v.adv_title}','1000px','700px')" class="dsui-btn-edit"><i class="iconfont"></i>{$Think.lang.ds_edit}</a>
                     <a href="javascript:dsLayerConfirm('{:url('Adv/adv_del',['adv_id'=>$v.adv_id])}','{$Think.lang.ds_ensure_del}',{$v.adv_id})" class="dsui-btn-del"><i class="iconfont"></i>{$Think.lang.ds_del}</a>
                    </td>
                </tr>
                <?php $index++; ?>
                {/foreach}
                {else /}
                <tr class="no_data">
                    <td colspan="15">{$ap_name}{$Think.lang.ds_no_record}</td>
                </tr>
                {/notempty}
            </tbody>
        </table>
        {$show_page}
    </form>
</div>
<script type="text/javascript" src="{$Think.ADMIN_SITE_ROOT}/js/jquery.edit.js" charset="utf-8"></script>
<link rel="stylesheet" href="{$Think.PLUGINS_SITE_ROOT}/js/jquery.lightbox/css/lightbox.min.css">
<script src="{$Think.PLUGINS_SITE_ROOT}/js/jquery.lightbox/js/lightbox.min.js"></script>
<script>
    $(function() {
        $("#homepage").click(() => {
            $("#popup-img").addClass('show');
        });
        $("#popup-img").click(() => {
            $("#popup-img").removeClass('show');
        });
        $("#mall").click(() => {
            $("#popup-imgs").addClass('show');
        });
        $("#popup-imgs").click(() => {
            $("#popup-imgs").removeClass('show');
        });
    });
</script>